import colorama, sys
colorama.init(autoreset=True)

def text(msg, fore='', back='', style='', end='\n'):
	if fore == 'black':
		fore = colorama.Fore.BLACK
	elif fore == 'red':
		fore = colorama.Fore.RED
	elif fore == 'green':
		fore = colorama.Fore.GREEN
	elif fore == 'yellow':
		fore = colorama.Fore.YELLOW
	elif fore == 'blue':
		fore = colorama.Fore.BLUE
	elif fore == 'magenta':
		fore = colorama.Fore.MAGENTA
	elif fore == 'cyan':
		fore = colorama.Fore.CYAN
	elif fore == 'reset':
		fore = colorama.Fore.RESET

	if back == 'black':
		back = colorama.Back.BLACK
	elif back == 'red':
		back = colorama.Back.RED
	elif back == 'green':
		back = colorama.Back.GREEN
	elif back == 'yellow':
		back = colorama.Back.YELLOW
	elif back == 'blue':
		back = colorama.Back.BLUE
	elif back == 'magenta':
		back = colorama.Back.MAGENTA
	elif back == 'cyan':
		back = colorama.Back.CYAN
	elif back == 'reset':
		back = colorama.Back.RESET

	if style == 'dim':
		style = colorama.Style.DIM
	elif style == 'normal':
		style = colorama.Style.NORMAL
	elif style == 'bright':
		style = colorama.Style.BRIGHT
	elif style == 'reset':
		style = colorama.Style.RESET_ALL

	print(f'{fore}{back}{style}{msg}',
		file=sys.stderr, end=end, flush=True)
